<?php
declare (strict_types = 1);

namespace app\shop\controller;

use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use app\common\service\UserService\MemberBankService;
use app\common\service\SmsService\SmsCodeService;
use app\BaseShopController;
use think\Request;
use app\Normal;

/**
 * @Group("MemberBank")
 * @Middleware({shopMiddileware::class})
 */
class MemberBank extends BaseShopController
{
    /**
     * 获取数据表分页
     * @Route("getList",method="GET")
     * @return string
     */
    public function getList() {     
        $result = callApi(MemberBankService::class, 'getList',$this->_all_data);
        return apiResponse($result);
    }
    
    /**
     * 发送短信
     * @Route("addMemberCard",method="POST")
     * @return string
     */
    public function addMemberCard() { 
        
        $param= $this->_data;
        $param['cid']= $this->_master_user['cid'];
        $param['cb_id']= $this->_master_user['cb_id'];
        unset($param['master_user_info']);
        $result = callApi(MemberBankService::class, 'addCard',$param);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'新增银行卡','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
}